/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package slcu.model.impl;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.impl.BaseModelImpl;

import slcu.model.Configuracion;
import slcu.model.ConfiguracionModel;

import java.io.Serializable;

import java.sql.Types;

import java.util.HashMap;
import java.util.Map;

/**
 * The base model implementation for the Configuracion service. Represents a row in the &quot;SLCU_Configuracion&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link slcu.model.ConfiguracionModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link ConfiguracionImpl}.
 * </p>
 *
 * @author tito
 * @see ConfiguracionImpl
 * @see slcu.model.Configuracion
 * @see slcu.model.ConfiguracionModel
 * @generated
 */
public class ConfiguracionModelImpl extends BaseModelImpl<Configuracion>
	implements ConfiguracionModel {
	/*
	 * NOTE FOR DEVELOPERS:
	 *
	 * Never modify or reference this class directly. All methods that expect a Configuracion model instance should use the {@link slcu.model.Configuracion} interface instead.
	 */
	public static final String TABLE_NAME = "SLCU_Configuracion";
	public static final Object[][] TABLE_COLUMNS = {
			{ "name", Types.VARCHAR },
			{ "value", Types.VARCHAR }
		};
	public static final String TABLE_SQL_CREATE = "create table SLCU_Configuracion (name VARCHAR(75) not null primary key,value VARCHAR(75) null)";
	public static final String TABLE_SQL_DROP = "drop table SLCU_Configuracion";
	public static final String DATA_SOURCE = "liferayDataSource";
	public static final String SESSION_FACTORY = "liferaySessionFactory";
	public static final String TX_MANAGER = "liferayTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.slcu.model.Configuracion"),
			true);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.slcu.model.Configuracion"),
			true);
	public static final boolean COLUMN_BITMASK_ENABLED = false;
	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.slcu.model.Configuracion"));

	public ConfiguracionModelImpl() {
	}

	public String getPrimaryKey() {
		return _name;
	}

	public void setPrimaryKey(String primaryKey) {
		setName(primaryKey);
	}

	public Serializable getPrimaryKeyObj() {
		return _name;
	}

	public void setPrimaryKeyObj(Serializable primaryKeyObj) {
		setPrimaryKey((String)primaryKeyObj);
	}

	public Class<?> getModelClass() {
		return Configuracion.class;
	}

	public String getModelClassName() {
		return Configuracion.class.getName();
	}

	@Override
	public Map<String, Object> getModelAttributes() {
		Map<String, Object> attributes = new HashMap<String, Object>();

		attributes.put("name", getName());
		attributes.put("value", getValue());

		return attributes;
	}

	@Override
	public void setModelAttributes(Map<String, Object> attributes) {
		String name = (String)attributes.get("name");

		if (name != null) {
			setName(name);
		}

		String value = (String)attributes.get("value");

		if (value != null) {
			setValue(value);
		}
	}

	public String getName() {
		if (_name == null) {
			return StringPool.BLANK;
		}
		else {
			return _name;
		}
	}

	public void setName(String name) {
		_name = name;
	}

	public String getValue() {
		if (_value == null) {
			return StringPool.BLANK;
		}
		else {
			return _value;
		}
	}

	public void setValue(String value) {
		_value = value;
	}

	@Override
	public Configuracion toEscapedModel() {
		if (_escapedModelProxy == null) {
			_escapedModelProxy = (Configuracion)ProxyUtil.newProxyInstance(_classLoader,
					_escapedModelProxyInterfaces,
					new AutoEscapeBeanHandler(this));
		}

		return _escapedModelProxy;
	}

	@Override
	public Object clone() {
		ConfiguracionImpl configuracionImpl = new ConfiguracionImpl();

		configuracionImpl.setName(getName());
		configuracionImpl.setValue(getValue());

		configuracionImpl.resetOriginalValues();

		return configuracionImpl;
	}

	public int compareTo(Configuracion configuracion) {
		String primaryKey = configuracion.getPrimaryKey();

		return getPrimaryKey().compareTo(primaryKey);
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		Configuracion configuracion = null;

		try {
			configuracion = (Configuracion)obj;
		}
		catch (ClassCastException cce) {
			return false;
		}

		String primaryKey = configuracion.getPrimaryKey();

		if (getPrimaryKey().equals(primaryKey)) {
			return true;
		}
		else {
			return false;
		}
	}

	@Override
	public int hashCode() {
		return getPrimaryKey().hashCode();
	}

	@Override
	public void resetOriginalValues() {
	}

	@Override
	public CacheModel<Configuracion> toCacheModel() {
		ConfiguracionCacheModel configuracionCacheModel = new ConfiguracionCacheModel();

		configuracionCacheModel.name = getName();

		String name = configuracionCacheModel.name;

		if ((name != null) && (name.length() == 0)) {
			configuracionCacheModel.name = null;
		}

		configuracionCacheModel.value = getValue();

		String value = configuracionCacheModel.value;

		if ((value != null) && (value.length() == 0)) {
			configuracionCacheModel.value = null;
		}

		return configuracionCacheModel;
	}

	@Override
	public String toString() {
		StringBundler sb = new StringBundler(5);

		sb.append("{name=");
		sb.append(getName());
		sb.append(", value=");
		sb.append(getValue());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(10);

		sb.append("<model><model-name>");
		sb.append("slcu.model.Configuracion");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>name</column-name><column-value><![CDATA[");
		sb.append(getName());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>value</column-name><column-value><![CDATA[");
		sb.append(getValue());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private static ClassLoader _classLoader = Configuracion.class.getClassLoader();
	private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
			Configuracion.class
		};
	private String _name;
	private String _value;
	private Configuracion _escapedModelProxy;
}